<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ include file="/parameter.jsp"%>
<%@ include file="/pageParam.jsp" %>
<%@page isELIgnored="false"%>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<Meta http-equiv="Pragma" Content="No-cach" />
<title>论坛首页</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
<script language="javascript">
	function loginsubmit() {
		return document.forms["form1"].submit();
	}
function SearchSubmit(){
	if(document.getElementById('keywords').value == ""){
		alert("请输入搜索关键字！");
		return false;
	}else{
		return document.forms["form3"].submit();
	}
}

window.onload = function(){
	var oFCKeditor = new FCKeditor('fcksummary') ;
	oFCKeditor.BasePath = '${pageContext.request.contextPath}/FCKeditor/' ;
	oFCKeditor.ToolbarSet = 'Default' ;
	oFCKeditor.Width = '100%' ;
	oFCKeditor.Height = '300' ;
	oFCKeditor.ReplaceTextarea();
}

function toSubmit(){
	var sortname = document.sortForm.boardname.value;
	if(sortname != null && sortname != ""){
		return sortForm.submit();
	}else{
		alert("不能提交空的分类名！");
		document.sortForm.boardname.focus();
		return false;
	}
	var topboard = document.getElementById("supersetid").value;
	if("" == topboard){
		alert("上级分类不能是空！");
		return false;
	}else{
		return sortForm.submit();
	}
}
</script>
	</head>

	<body>
	<jsp:include page="inc/header.jsp" />
		<header class="entry-header">
			<h1 class="entry-title">
				<span>论坛首页<div id="searchbar">
				<form name="form3" method="post" action="commonAction.do?method=SearchTopic">
					<input type="text" id="keywords" name="keywords" title="搜索"><button onClick="search();">搜索</button>
				</form>
				</div></span>
			</h1>
		</header>
		
		<div id="maindiv">
			<div id="nav">
			<c:choose>
				<c:when test="${sessionScope.user == null}">
					<div>
						<form name="form1" method="post" action="commonAction.do?method=UserLogin">
						账号：<input type="text" name="username"> 密码：<input type="password" name="password"> 
						<button onClick="loginsubmit();">登陆</button> <a href="commonAction.do?method=toRegister">注册新账号</a>
						</form>
					</div>
				</c:when>
				<c:otherwise>
					<div>
					&nbsp;&nbsp;<c:choose><c:when test="${sessionScope.user.nickname != ''}">${sessionScope.user.nickname}</c:when><c:otherwise>${sessionScope.user.username}</c:otherwise></c:choose>&nbsp;你好！<a
							href="commonAction.do?method=Logout">注销</a>&nbsp;|&nbsp;<a
							href="commonAction.do?method=EditUserInfo&uid=${sessionScope.user.id}">修改个人信息</a>&nbsp;|&nbsp;<a
							href="commonAction.do?method=EditUserPwd&uid=${sessionScope.user.id}">修改密码</a>
					</div>
				</c:otherwise>
			</c:choose>
				<a href="./" title="首页">首页</a>
				<span>&gt;</span>
                板块分类管理
			</div>
			<c:if test="${sessionScope.user.usergrade == '0'}">
			<div class="mngbar"><a href="commonAction.do?method=UserManagerPer">用户管理</a> | <a href="commonAction.do?method=SortPer">板块分类管理</a> | <a href="commonAction.do?method=BoardPer">板块管理</a> | <a href="commonAction.do?method=RecordPer">操作记录</a></div>
			</c:if>
			<div id="board">
				<div class="bm">
					<div class="bm_h">
						<h2>板块分类管理</h2>
					</div>
					<div class="bm_b">
							<form name="sortForm" method="post" action="commonAction.do?method=BoardModifyDo" onSubmit="return Validator.Validate(this, 3)">
								<!--<div class="msg">
									<span class="message cl">&#8226;&nbsp;提示消息样式</span>
									<span class="error cl">&#8226;&nbsp;错误消息样式<span>
								</div>-->
								<div class="frm_row">
									<label>上级分类: </label><span>
									<select name="supersetid" datatype="Require" msg="必须选择" >
										<option value="">请选择...</option>
										<c:forEach items="${parentBoardList}" var="board">
										<option value="${board.id}" <c:if test="${boardBean.supersetid == board.id}">selected</c:if>>${board.boardname}</option>
										</c:forEach>
									</select></span>顶级分类！如果不选择，则为顶级分类，默认设置为顶级分类！
								</div>
								<div class="frm_row">
									<label>本级分类名称: </label><input type="text" class="input2" id="boardname" name="boardname" size="30" maxlength="50" value="${boardBean.boardname}" title="本级分类名称" datatype="Require" msg="必须填写" />需要添加的分类！
								</div>
								<div class="frm_row">
									<label>是否首页显示: </label><span>
									<select name="isdisplay" title="是否在首页显示" datatype="Require" msg="必须选择">
										<option value="0" <c:if test="${boardBean.isdisplay == 0}">selected</c:if>>是</option>
										<option value="1" <c:if test="${boardBean.isdisplay == 1}">selected</c:if>>否</option>
									</select></span>默认为在首页显示！
								</div>
								<div class="frm_row">
									<label>分类关键字: </label><input type="text" class="input2" id="postkey" name="postkey" size="30" maxlength="50" value="${boardBean.postkey}" title="分类关键字"/>添加的分类关键字，没个关键字用逗号分开！
								</div>
								<div class="frm_row">
									<label>分类序号: </label><input type="text" class="input2" id="orderby" name="orderby" size="30" maxlength="50" value="${boardBean.orderby}" title="分类序号"/>添加的分类的排序号，默认为99！
								</div>
								<div class="frm_row">
									<label>设置版主: </label><span>
									<select name="masterid" title="设置版主">
										<option value="0">请选择...</option>
										<c:forEach items="${user}" var="user">
										<option value="${user.id}" <c:if test="${boardBean.boarduser.id == user.id}">selected</c:if>>${user.username}</option>
										</c:forEach>
									</select></span>
								</div>
								<div class="frm_row">
									<label>板块描述: </label><textarea id="fcksummary" name="summary">${boardBean.summary}</textarea>
								</div>

								<div class="frm_row"><input type="hidden" name="id" value="${param.id}"/>
									<button type="submit"> 保 存 </button>
								</div>
							</form>
					</div>

				</div>
			</div>
		</div>
	<jsp:include page="inc/footer.jsp" />
	</body>
<script language="javascript">
</script>
</html>
